package com.totoro.domain;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.totoro.domain.key.RoleResourceKey;

/**
 * Role-Resource关联实体类
 */
@Entity
@Table(name = "role_resource")
@IdClass(value = RoleResourceKey.class)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class RoleResource extends BaseDomain {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Id
	private Resource resource;// 资源
	@Id
	private Role role;// 角色

	// 空的构造器
	public RoleResource() {
	}

	// 带参数的构造器
	public RoleResource(Resource resource, Role role) {
		super();
		this.resource = resource;
		this.role = role;
	}

	public Resource getResource() {
		return resource;
	}

	public void setResource(Resource resource) {
		this.resource = resource;
	}

	public Role getRole() {
		return role;
	}

	public void setRole(Role role) {
		this.role = role;
	}

}